home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Add-Ons
/
MPW
/
MPW dmake 4.0
/
BuildProgram
< prev
next >
Wrap
Text File
|
1995-12-05
|
2KB
|
84 lines
# BuildProgram - build the specified program
#
# Usage:
# BuildProgram program [options…] > log
#
# The BuildProgram script builds the specified program (or target).
# A simple transcript of the build is written to standard output.
#
# Make is used to generate the build commands. If file <program>.make
# exists it is used as the makefile. If not, file MakeFile is used.
#
# The options specified are passed directly to Make, and control the
# generation of the build commands.
#
#
# Copyright Apple Computer, Inc. 1987 - 1992
# All rights reserved.
#
# Modified for dmake by Matthias Neeracher
#
Set Exit 1
# Find the program parameter.
Unset program
For i In {"Parameters"}
If "{i}" !~ /-≈/
Set program "{i}"
Break
End
End
If "{program}" == ""
Echo "### {0} - Specify a program to build." > Dev:StdErr
Echo "# Usage - {0} program [options…]" > Dev:StdErr
Exit 1
End
# Select the makefile.
Set makefile `(Files -t TEXT "{program}".mk || ∂
Files -t TEXT "{program}".make || ∂
Files -t TEXT makefile.mk || ∂
Files -t TEXT MakeFile || ∂
Echo '""') ≥ Dev:Null`
If "{makefile}" == ""
Echo "### {0} - No makefile exists for {program}." > Dev:StdErr
Exit 1
Else if "{makefile}" =~ /≈.mk/
Set Make "dmake -n"
if "{1}" == "-e"
set everything -u
shift
end
Else
Set Make "Make"
End
# Run Make, then execute its output.
Echo "# `Date -t` ----- Build of {program}."
Echo "# `Date -t` ----- Analyzing dependencies."
Begin
Echo "Set Echo 1"
{Make} {Everything} {"Parameters"} -f "{makefile}"
End > "{program}".makeout
Echo "# `Date -t` ----- Executing build commands."
"{program}".makeout
Delete "{program}".makeout
Echo "# `Date -t` ----- Done."
Set type "`files -i -n -x t "{program}" ≥ Dev:Null || Set Status 0`"
Set CaseSensitive True #filetype check for DA must be case sensitive
If "{type}" =~ /≈ APPL/ OR "{type}" =~ /≈ MPST/ # application or tool
Echo -n ∂t; Quote -n "{program}"; Echo -n " "
Else If "{type}" =~ /≈ DFIL/ # desk accessory in Suitcase
Echo -n ∂t
Quote -n "Font/DA Mover" "{SystemFolder}"System "{program}";
Echo -n " # Install DA"
Else If "{type}" =~ /≈ dfil/ # desk accessory (System 7)
Echo -n ∂t
Quote -n Duplicate -y "{program}" "{SystemFolder}Apple Menu Items";
Echo -n " # Install DA into Apple Menu"
End